package com.wwwarehouse.usercenter.fragment.permissiondistribute;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.wwwarehouse.common.activity.BaseCardDeskActivity;
import com.wwwarehouse.common.activity.base.BaseFragment;
import com.wwwarehouse.usercenter.R;


/**
 * author ：minifly
 * date: 2017/8/31
 * time: 14:35
 */

public class PermissionNotFoundFragment extends BaseFragment {

    public static final String KEY_TYPE = "key_type";
	private TextView mTvDesc;
	private int mType;

	@Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
		Bundle bundle = getArguments();
		if (bundle != null) {
			mType = bundle.getInt(KEY_TYPE);
		}
	}

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_permission_notfound, container, false);
    }

    @Override
    public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
		mTvDesc = $(R.id.tv_desc);
		((BaseCardDeskActivity) mActivity).hideBackBt();
		switch (mType) {
			case 0:
				mTvDesc.setText("权限生效、失效时间配置错误");
				break;
			case 1:
				mTvDesc.setText("授权人的权限发生变化");
				break;
		}
	}


    @Override
    public void onDestroy() {
        super.onDestroy();
        ((BaseCardDeskActivity) mActivity).showBackBt();
    }

    @Override
    public void setTitle() {
        if (peekFragment() instanceof PermissionNotFoundFragment) {
            mActivity.setTitle(R.string.receiver_permission);
        }
    }

    @Override
    public void requestDatas() {

    }
}
